package com.sky.mapper;

import com.sky.dto.ShoppingCartDTO;
import com.sky.entity.ShoppingCart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {
    /**
     * 查询购物车数据
     * @param shoppingCart
     * @return
     */
    List<ShoppingCart> list(ShoppingCart shoppingCart);

    /**
     * 添加一条购物车数据
     * @param shoppingCart
     */
    void add(ShoppingCart shoppingCart);

    /**
     * 修改商品数量
     * @param shoppingCart
     */
    void updateNumber(ShoppingCart shoppingCart);

    /**
     * 删除一个商品
     * @param shoppingCart1
     */
    void deleteOne(ShoppingCart shoppingCart1);

    /**
     * 清空购物车
     * @param currentId
     */
    @Delete("delete from sky_take_out.shopping_cart where user_id = #{currentId}")
    void clean(Long currentId);

    /**
     * 批量插入购物车数据
     * @param shoppingCartList
     */
    void insertBatch(List<ShoppingCart> shoppingCartList);
}
